package com.abk.ets.service;

import java.util.List;

import javax.ejb.EJB;
import javax.faces.bean.SessionScoped;

import org.springframework.stereotype.Service;

import com.abk.ets.dao.ContratHome;
import com.abk.ets.dao.SocieteHome;
import com.abk.ets.data.Contrat;
import com.abk.ets.data.Investisseur;
import com.abk.ets.data.Societe;

@Service
@SessionScoped
public class GestionnaireAdmin {
	
	private String nomSociete;
	private String mail;
	private int capital;
	private List<Investisseur> listIn;
	private List<Contrat> listcon;
	
	@EJB
	SocieteHome societeDao;
	@EJB
	ContratHome contratDao;
	
	public String getNomSociete() {
		return nomSociete;
	}


	public void setNomSociete(String nomSociete) {
		this.nomSociete = nomSociete;
	}


	public String getMail() {
		return mail;
	}


	public void setMail(String mail) {
		this.mail = mail;
	}


	public int getCapital() {
		return capital;
	}


	public void setCapital(int capital) {
		this.capital = capital;
	}


	public void creerSociete() {
		Societe societe = new Societe();
		societe.setNomSociete(nomSociete);
		societe.setMail(mail);
		societe.setCapital(capital);
		societeDao.persist(societe);
	}
	
	public void rechercheSociete() {
		
	}
	
	public void rechercherContratParNomSociete() {
		Societe societe = new Societe();
		listcon = contratDao.findBySociete(societe);
	}
}
